function addNewRow(plusButton) {
	/* get the next id */
	var lastId = $('#addedFriendsTable tr:last').attr("id");
	var oldId = lastId[lastId.length-1];
	var nextId = parseInt(oldId)+1;
	var newId = "addedfriend"+nextId;
	// remove add button from previous row
	var content = $('#addedFriendsTable td:last').contents()[0];
	$(content).remove();
	
	$('#addedFriendsTable tr:last').after("<tr id = "+ newId +">"+
				"<td class='inviteTableCell'><input type='checkbox' onclick='countInvites(this);'/></td>"+
				"<td class='inviteTableCell'><input type='text' id='"+newId+"name' name='person_lname' size='15'></td>"+
				"<td class='inviteTableCell'><input type='text' id='"+newId+"surname' name='person_fname' size='15'></td>"+
				"<td class='inviteTableCell'><input type='text' id='"+newId+"mail' name='person_email' size='15'></td>"+
				"<td class='inviteTableCell'><input type='button' class='button' value='+' onclick='addNewRow(this)'/></td></tr>");
}

function countInvites(checkbox) {
	document.getElementById("numberOfFriends").value=$('input:checked').size();
};
